package com.example.mapper.vomapper;

import com.example.entity.axd.vo.*;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.security.core.parameters.P;
import org.springframework.stereotype.Repository;

import java.util.List;

/*
 *  @author 雨安
 *  类名： TestMapper
 *  创建时间：2024/3/12
 */
@Repository
public interface TestMapper {

    //企业表
    @Select("select DISTINCT hous_name ,addr ,b.charger_name ,\n" +
            "       economic_type_name ,legal_id_num ,b.lice_no ,\n" +
            "           operate_rahge_hame ,contacter ,lssu_date\n" +
            "    from businessoperation b\n" +
            "    left join householdinformation h\n" +
            "    on b.lice_no = h.lice_no ORDER BY lssu_date DESC")
    List<FirmTest> selectAllList();

    //车辆基础信息 以完成云端上传
    @Select("select DISTINCT substr(plate_Num,1,7),\n" +
            "SUBSTR(r.plate_Num, 1, 7) car_no ,SUBSTR(r.plate_Num,8,10) car_no_color,\n" +
            "yingyunztbm ,r.vehi_type ,r.busi_scope ,h.jingyingfwbm ,\n" +
            "h.xingshizscdjrq ,h.zongzhiliang ,daolyyszzh ,\n" +
            "fadongjhim ,r.hous_name,h.chejiah vin\n" +
            "from roadtransport r\n" +
            "left join heavygeneralcargo h on substr(plate_Num,1,7) = chepaihm\n" +
            "where is_flag = 1  ${condition}")
    List<CarTest> selectCarList(@Param("condition")String condition);

    //年审表
    @Select("select DISTINCT substr(plate_Num,1,7),substr(r.plate_Num,1,7) plate_Num,chepaihm,h.daoluyszh ,h.fazhengrq ,\n" +
            "r.card_end_date ,h.nianshenyxjzq ,h.fujian ,r.card_id\n" +
            "from roadtransport r\n" +
            "left join heavygeneralcargo h on SUBSTR(r.plate_Num, 1, 7) = chepaihm\n" +
            "where is_flag = 1 ${condition} ")
    List<NianShenTest> selectNianSheng(@Param("condition")String condition);

    //行驶证
    @Select("select DISTINCT(chepaihm), chepaihm ,h.xingshizscdjrq ,h.xingshiznsyxrq ,\n" +
            "h.cheliangxszh ,h.yujibfrq ,h.fujian,car.id car_id\n" +
            "from heavygeneralcargo h\n" +
            "left join axd_car_base_info car on chepaihm = car_no")
    List<XingShiZhengTest> selectXingShiZheng();


    @Select("select r.plate_Num ,h.daoluyszh ,h.fazhengrq ,\n" +
            "       h.nianshenyxjzq ,h.fujian ,r.card_id\n" +
            "from heavygeneralcargo h\n" +
            "         left join roadtransport r on h.chepaihm = substr(r.plate_Num,1,7)\n" +
            "where r.is_flag = 1")
    List<DaoLuYunShuTest> selectDaoLuYunShuZheng();


    @Select("select DISTINCT(substr(plate_Num,1,7)),plate_Num ,rt.engine_discharge  ,rt.engine_power ,\n" +
            "               rt.vehicle_color  ,rt.fuel_type_Code  ,h.bianhao ,\n" +
            "               rt.vehi_length ,rt.vehi_width ,rt.vehi_high,car.id card_id\n" +
            "from roadtransport r\n" +
            "left join roadtransportvehicles rt on substr(plate_Num,1,7) = rt.vehicle_no\n" +
            "left join heavygeneralcargo h on substr(plate_Num,1,7) = h.chepaihm\n" +
            "left join axd_car_base_info car on car.car_no = substr(plate_Num,1,7)\n" +
            "where is_flag = 1 ${condition}")
    List<CheLiangJiShuTest> selectCheLiangJiShuDengJi(@Param("condition")String condition);

}
